﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using BrokerBase.Lib.Core;
using BrokerBase.Lib.Metadata;
using BrokerBase.Lib.Base;
using BrokerBase.Lib.Company;
using BrokerBase.Lib.Person;
using BrokerBase.Lib.Dynamic;
using BrokerBase.Lib.Policy;
using BrokerBase.Lib.Product;
using NHibernate;



namespace BrokerBase.Lib.Policy
{

    /// <summary>
    /// 保单被保人类型：
    /// Insurant=保险方案被保人
    /// Holder=保险方案投保人
    /// </summary>
    public enum PolicyTarget { Insurant = 0, Holder = 1 }

    /// <summary>
    /// 人员类型
    /// </summary>
    public enum PersonType { Insurant = 0, Holder = 1 }
    /// <summary>
    /// 保单
    /// </summary>
    public interface IPolicy:IPK,IBasePolicy
    {
        /// <summary>
        /// 所属的方案
        /// </summary>
        //IScheme Owner { get; set; }

        /// <summary>
        /// 产品
        /// </summary>
        IProduct Product { get; set; }
        /// <summary>
        /// 选择的列头固定费率
        /// </summary>
        IDictionary<string, string> SelectedColRateFactors { get; set; }
        /// <summary>
        /// 选择的行头固定费率
        /// </summary>
        IDictionary<string, string> SelectedRowRateFactors { get; set; }
        /// <summary>
        /// 选择的调整费率
        /// </summary>
        IDictionary<string, string> SelectedAdjRateItems { get; set; }
        /// <summary>
        /// 设置设置的锁定状态
        /// </summary>
        void SetSettingLock(string name, bool aLock);
        /// <summary>
        /// 读取设置的锁定状态
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        bool GetSettingLock(string name);

        void SettingLockClear();
        /// <summary>
        /// 选择的基本保额
        /// </summary>
        IBasicAmount SelectedBasicAmount { get; set; }
        /// <summary>
        /// 选择的付款期限
        /// </summary>
        IPaymentPeriod SelectedPaymentPeriod { get; set; }
        
        /// <summary>
        /// 跨付款期长度，默认等于1
        /// 当附加险的付款期等于1年时，overperiod可以大于1.
        /// </summary>
        int OverPaymentPeriod { get; set; }

        //int PaymentPeriodLength { get; }
        /// <summary>
        /// 选择的保险期限
        /// </summary>
        IInsurancePeriod SelectedInsurancePeriod { get; set; }

        int OverInsurancePeriod { get; set; }

        //int InsurancePeriodLength { get; }
        

        /// <summary>
        /// 选择的付款周期
        /// </summary>
        //ITimeUnit SelectedTimeUnit{ get; set; }
        /// <summary>
        /// 保额
        /// </summary>
        //double Amount { get; set; }
        /// <summary>
        /// 基本保费(对应费率表的基本费率)
        /// </summary>
        double FixFee { get; set; }

        double[] FixFees { get; set; }

        //double[] AllFixFees { get; set; }

        /// <summary>
        /// 保费
        /// </summary>
        //double Fee { get; }

        double[] Fees { get;}

        //double Fee2 { get; set; }
        /// <summary>
        /// 付款方式的每个周期付款
        /// </summary>
        double TimeUnitFee { get;}
        /// <summary>
        /// 合计保费
        /// </summary>
        double TotalFee { get;}

        //double TotalFee2 { get; set; }

        RatePos GetRatePos(IList<string> colRateKeys,string key);


        string GetSelectedRateFactorItem(string rateFactorName, RateFactorAxis axis);

        string GetColKey();

        double AdjRateCoefficient { get; }

        void SettingDefault();

        
        
    }
}
